Skip to content

feat(automation): route trusted review-agent mentions - #787

Draft
seonghobae wants to merge 131 commits into
mainfrom
feat/review-agent-mention-router-main
Draft

feat(automation): route trusted review-agent mentions#787
seonghobae wants to merge 131 commits into
mainfrom
feat/review-agent-mention-router-main

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Purpose

Add a protected-default-branch control plane that lets trusted ContextualWisdomLab maintainers invoke the existing Noema and OpenCode review workflows from exact pull-request comments without granting the invocation path branch-update, merge, release, or author-approval authority.

Product behavior

  • Accepts only exact @cwl-noema-review and @opencode-agent handles from OWNER, MEMBER, or COLLABORATOR comments on live pull requests.
  • Binds every request to repository, PR number, immutable head SHA, base branch, requested agent, source comment ID, and requesting actor.
  • Uses an exact-name central Actions artifact ledger, cwl-agent-invocation-<SHA-256 key>, instead of capped workflow-run enumeration.
  • Queries the artifact endpoint by exact name, validates complete response structure, and shares a per-run lookup cache across the organization sweep.
  • Serializes same-key wrapper runs, validates the canonical key again, uploads a 30-day immutable claim, and only then forwards to the authoritative review workflow. GitHub's current artifact action makes uploaded artifacts immediately available to the REST API.
  • Treats target-repository reactions and acknowledgement comments as user-experience signals, never as dispatch authority.
  • Keeps OpenCode review-only: enable_auto_merge=false, update_branches=false, and merge_mode=disabled.
  • Traverses recently updated PRs lazily, stops at the lookback cutoff, counts only newly queued requests against the dispatch budget, and isolates repository/PR/request failures while returning a failing sweep status when any isolation boundary was exercised.

Reliability and security repairs

  • Eliminated the partial-completion redispatch window with per-agent exact-key durable claims and same-run cache updates.
  • Removed target-comment receipt authority, preventing forged or identity-drifted markers from suppressing or replaying review work.
  • Avoided GitHub's 1,000-result filtered workflow-run ceiling through exact-name artifact lookup.
  • Added fail-closed artifact response validation, malformed metadata validation, actor/allowlist normalization, bounded gh api diagnostics, bounded external HTTP calls, and explicit intentional BLE001 isolation annotations.
  • Removed every transient PR-specific writer workflow and branch-mutation helper before the final head.
  • Pinned checkout, hardening, setup, and artifact actions to immutable commit SHAs; checkout credentials are not persisted.

Exact-head verification

Head: 29ff8b5017c41f591eaa5fb8531aac53ce50f798
Base: f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae

Successful exact-head checks:

  • Agent Mention Router Quality CI — run 31103422189
  • CodeQL PR — run 31103422617
  • Python Security — run 31103425420
  • SAST Semgrep — run 31103424726
  • Security Scan — run 31103422271
  • Secret Scan — run 31103422499
  • OSV-Scanner PR — run 31103424044
  • Scorecard PR — run 31103422953
  • SBOM Generation — run 31103422221
  • CodeRabbit commit status — success

Quality evidence on the exact head:

  • 958 passed
  • scripts/ci/agent_mention_router.py: 229 statements, 98 branches, 100%
  • scripts/ci/agent_mention_sweep.py: 162 statements, 66 branches, 100%
  • Total production coverage: 391 statements and 164 branches, 100%
  • Public docstring coverage: 100%
  • Unresolved inline review threads: 0

Remaining merge gates

The latest OpenCode CHANGES_REQUESTED review is anchored to predecessor head 92c83f44c75cae42e90dc6984dc89c696b6c3db9 and is not reused. This exact head still requires fresh current-head automated review and a non-author independent APPROVE. Branch protection, review independence, and exact-head checks must remain satisfied; this PR must not be merged by bypass.

Summary by CodeRabbit

  • 새로운 기능

    • PR 댓글의 지정된 에이전트 멘션을 자동으로 감지하고 리뷰 요청을 전달합니다.
    • 조직 내 최근 멘션을 주기적으로 확인해 누락된 요청을 처리할 수 있습니다.
    • 중복 요청을 방지하고 부분 실패 시 필요한 작업만 재시도합니다.
    • 미리보기 실행과 처리 결과 확인을 지원합니다.
  • 문서

    • 리뷰 요청 방식, 권한, 운영 한도 및 문제 발생 시 복구 절차를 추가했습니다.
  • 품질 개선

    • 입력 검증, 권한 경계, 오류 처리와 자동화 흐름에 대한 검증을 강화했습니다.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 91f72f51-9e5e-4211-a209-054cf919eaaa

📥 Commits

Reviewing files that changed from the base of the PR and between 545caf0 and a32efd5.

📒 Files selected for processing (1)
  • .github/workflows/repair-pr787-final-payload-binding.yml
📝 Walkthrough

Walkthrough

PR 댓글과 5분 주기 조직 스윕에서 에이전트 멘션을 검증하고 중앙 workflow로 전달합니다. Canonical payload 기반 invocation key와 30일 Actions artifact ledger로 중복 dispatch를 억제합니다. 품질 workflow, 계약 테스트, 운영 문서도 추가합니다.

Changes

에이전트 멘션 라우팅

Layer / File(s) Summary
라우터 검증 및 dispatch
.github/workflows/agent-mention-router.yml, scripts/ci/agent_mention_router.py, tests/test_agent_mention_router.py, tests/test_agent_mention_rejection_idempotency.py, tests/test_agent_mention_receipt_authority.py
신뢰된 댓글과 정확한 멘션을 검증합니다. Canonical payload에서 invocation key를 생성합니다. 중앙 dispatch와 대상 댓글 acknowledgement를 처리합니다.
조직 댓글 스윕 및 실행 연결
.github/workflows/agent-mention-router.yml, scripts/ci/agent_mention_sweep.py, tests/test_agent_mention_sweep.py, tests/test_agent_mention_sweep_regressions.py
조직 또는 설치 저장소의 최근 PR과 댓글을 조회합니다. 열린 PR의 유효한 멘션을 제한된 수만큼 dispatch합니다. 후보별 오류를 격리하고 종료 코드를 관리합니다.
Downstream 리더 선출 및 전달
.github/workflows/agent-mention-noema-dispatch.yml, .github/workflows/agent-mention-opencode-dispatch.yml, tests/test_agent_mention_idempotency.py, tests/test_agent_mention_artifact_ledger.py, tests/test_agent_mention_downstream_idempotency.py, tests/test_agent_mention_review_regressions.py
Noema와 OpenCode workflow가 payload 형식과 SHA-256 digest를 검증합니다. 활성 artifact claim이 없을 때만 30일 ledger를 생성하고 authoritative dispatch를 수행합니다.
Payload binding 복구 및 최종화
.github/workflows/repair-pr787-finalize-payload-binding.yml
복구 workflow가 base_branch, canonical digest, 작업 범위 권한을 두 downstream workflow에 적용합니다. 검증 후 대상 브랜치에 force-with-lease로 게시합니다.
품질 게이트 및 운영 계약
.github/workflows/agent-mention-router-quality-ci.yml, docs/automation/review-agent-comment-invocation.md, CHANGELOG.md, tests/test_agent_mention_workflow_contract.py, tests/test_pr_review_fix_scheduler_coverage.py
Python 3.14, 전체 테스트, 100% 브랜치 커버리지, 컴파일 및 diff 검사를 실행합니다. 이벤트, 권한, artifact ledger, 자격 증명 및 롤백 절차를 문서화합니다.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PRComment
  participant AgentMentionRouter
  participant ArtifactLedger
  participant DownstreamWorkflow
  participant ReviewWorkflow
  PRComment->>AgentMentionRouter: 신뢰된 에이전트 멘션 전달
  AgentMentionRouter->>AgentMentionRouter: 요청 필드와 canonical payload 검증
  AgentMentionRouter->>ArtifactLedger: 에이전트별 invocation artifact 조회
  ArtifactLedger-->>AgentMentionRouter: 활성 claim 상태 반환
  AgentMentionRouter->>DownstreamWorkflow: 신규 repository dispatch 전달
  DownstreamWorkflow->>ArtifactLedger: invocation claim artifact 업로드
  DownstreamWorkflow->>ReviewWorkflow: 검증된 authoritative dispatch 전달
Loading
sequenceDiagram
  participant Scheduler
  participant AgentMentionSweep
  participant GitHubAPI
  participant AgentMentionRouter
  Scheduler->>AgentMentionSweep: 5분 주기 스윕 실행
  AgentMentionSweep->>GitHubAPI: 저장소와 최근 PR 조회
  GitHubAPI-->>AgentMentionSweep: 접근 가능한 저장소와 PR 반환
  AgentMentionSweep->>GitHubAPI: PR 댓글 조회
  GitHubAPI-->>AgentMentionSweep: 최근 댓글 반환
  AgentMentionSweep->>AgentMentionRouter: 유효한 MentionRequest dispatch
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 94.70% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 신뢰된 리뷰 에이전트 멘션을 라우팅하는 주요 변경사항을 간결하고 명확하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/review-agent-mention-router-main

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as ready for review August 5, 2026 13:16

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review @coderabbitai review

Review exact head cf4400f7f8fe673f1f89c467a6629bd92dcaae2c against protected main f070c504c1cb06891b800d7ab0cf6ac7d3cf8eae. Exact-head Agent Mention Router Quality CI and all direct Python Security, Security Scan, CodeQL, Semgrep, Secret Scan, OSV, Scorecard, and SBOM workflows are successful. Verify trusted association handling, exact-head/base dispatch binding, idempotent receipts, bounded organization sweep, OpenCode target allowlisting, explicit review-only merge controls, immutable action pins, credential scope, permanent 100% statement/branch/docstring evidence, absence of approval/merge/release/protection mutation, and no temporary write workflow. Submit a formal current-head approval only if independent branch-protection requirements are satisfied; otherwise provide source-backed actionable findings. Do not reuse predecessor #757 evidence.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

@seonghobae: I will review pull request #787 at the specified current head. I will use only current-head evidence. I will check the requested control-plane and safety boundaries before I make an approval decision.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae enabled auto-merge (squash) August 5, 2026 13:26
@seonghobae
seonghobae marked this pull request as draft August 5, 2026 13:35
auto-merge was automatically disabled August 5, 2026 13:35

Pull request was converted to draft

@seonghobae
seonghobae marked this pull request as ready for review August 5, 2026 13:35
@seonghobae
seonghobae enabled auto-merge (squash) August 5, 2026 13:36

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head reliability finding (valid, blocking the claimed receipt-based idempotency): dispatch_request() writes its only durable receipt after dispatching Noema, dispatching OpenCode, adding a reaction, and then posting the acknowledgement. If any later call fails after an earlier repository dispatch succeeds—for example, Noema succeeds and OpenCode or the reaction/comment call fails—the source comment remains unreceipted. The five-minute sweep retries it and dispatches the already-successful agent again. The current Noema repository-dispatch concurrency key is PR-scoped with cancel-in-progress: true, so this failure window can cancel/restart a legitimate review rather than merely producing a harmless duplicate.

Please fix test-first with fault injection at every external-call boundary. The durable protocol must track completion per requested agent and allow retrying only missing work. Because there is still an unavoidable crash window between a successful GitHub repository-dispatch response and recording that success, the downstream Noema/OpenCode entrypoints should also enforce idempotency using a deterministic key containing at least target_repository, PR number, exact head SHA, requested agent, and source_comment_id. Receipt/reaction failure must not cause completed agent work to be redispatched, and a partially completed request must not be treated as fully processed. Update the operator record and claim boundary accordingly; do not weaken the current exact-head or review-only controls.

@opencode-agent
opencode-agent Bot disabled auto-merge August 5, 2026 13:52

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head blocking defect in the sibling-repository sweep: processed_comment_ids() accepts receipt markers only when the comment author is exactly github-actions[bot], but the scheduled sweep posts target-repository acknowledgements through TARGET_REPOSITORY_TOKEN (PR_REVIEW_MERGE_TOKEN, OPENCODE_APPROVE_TOKEN, or an OpenCode installation token). Those comments are authored by the PAT user or GitHub App bot—not by github-actions[bot]. Consequently, the next five-minute sweep does not recognize its own sibling-repository receipt and redispatches the same mention repeatedly for the entire lookback window (subject only to each run's dispatch cap). This also amplifies the partial-failure idempotency defect from my preceding review.

Please add a failing end-to-end sweep regression using realistic PAT and installation-bot acknowledgement identities, then bind receipt recognition to the authenticated target-token identity (or another durable, non-spoofable central receipt protocol) rather than a hard-coded local-workflow actor. Do not broadly trust arbitrary bot/user markers: a repository workflow or collaborator must not be able to forge a receipt and suppress a required review. Verify local github-actions[bot], cross-repository PAT, and installation-token paths, repeated sweep runs, mixed legitimate/forged markers, token rotation, and partial agent completion. The current head should not merge while the advertised organization sweep can create an unbounded redispatch loop.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head cf4400f7f8fe673f1f89c467a6629bd92dcaae2c.

  • Head SHA: cf4400f7f8fe673f1f89c467a6629bd92dcaae2c

  • Workflow run: 31012190358

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow (2 files)"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow (2 files)"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file: CHANGELOG.md"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file: CHANGELOG.md"]
  R2 --> V2["required checks"]
  Evidence --> S3["Docs: review-agent-comment-invocation.md"]
  S3 --> I3["operator or user guidance"]
  I3 --> R3["Review risk: Docs: review-agent-comment-invocation.md"]
  R3 --> V3["docs review"]
  Evidence --> S4["CI script (2 files)"]
  S4 --> I4["review and security gate shell path"]
  I4 --> R4["Review risk: CI script (2 files)"]
  R4 --> V4["bash -n plus Strix self-test"]
  Evidence --> S5["Test (3 files)"]
  S5 --> I5["regression suite"]
  I5 --> R5["Review risk: Test (3 files)"]
  R5 --> V5["targeted test run"]
Loading

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/repair-pr787-finalize-payload-binding.yml (1)

53-261: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

git diff --check만으로는 수정 결과를 검증할 수 없습니다.

라인 261의 git diff --check는 공백 오류만 검사합니다. 조건부 replace_once 블록이 모두 건너뛰어져도 이 단계는 성공합니다. 라인 298-299의 hmac.compare_digest 개수 검사가 일부를 보완하지만, 라우터의 base_branch payload 필드와 문서·CHANGELOG 항목에는 동등한 사후 검증이 없습니다.

각 대상 변경에 대해 명시적 사후 조건 검사를 추가하십시오.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/repair-pr787-finalize-payload-binding.yml around lines 53
- 261, Replace the final whitespace-only validation around the repair script
with explicit postcondition checks for every targeted change. After writing the
router, Noema/OpenCode workflows, tests, documentation, and CHANGELOG, assert
that each required base_branch payload/environment/validation field, digest
verification, scoped permission, test assertion, documentation sentence, and
changelog entry exists exactly as intended; raise an error identifying the
missing postcondition before running git diff --check.
tests/test_agent_mention_artifact_ledger.py (1)

192-192: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

테스트 이름의 오타를 수정하십시오.

test_doctoring_records_artifact_ledger_contractdoctoring은 의도한 단어가 아닙니다. 이 테스트는 문서 계약을 검증합니다.

♻️ 제안 수정
-def test_doctoring_records_artifact_ledger_contract() -> None:
+def test_documentation_records_artifact_ledger_contract() -> None:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_agent_mention_artifact_ledger.py` at line 192, 테스트 함수
test_doctoring_records_artifact_ledger_contract의 오타를 수정하여 문서 계약을 검증한다는 의미가 드러나는
이름으로 변경하십시오. 테스트 로직과 동작은 그대로 유지하십시오.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/agent-mention-noema-dispatch.yml:
- Around line 80-162: Serialize identical invocation claims by adding
INVOCATION_KEY to the workflow concurrency.group and setting cancel-in-progress
to false in .github/workflows/agent-mention-noema-dispatch.yml lines 80-162 and
.github/workflows/agent-mention-opencode-dispatch.yml lines 90-172. Apply the
same concurrency configuration to both workflows; no other changes are required.

In @.github/workflows/repair-pr787-finalize-payload-binding.yml:
- Around line 1-15: Remove the entire temporary workflow file defining “Repair
PR 787 finalize payload binding,” including its trigger, permissions,
concurrency, and force-push logic; do not rely on runtime self-deletion or
retain any repository-local writer workflow.

---

Nitpick comments:
In @.github/workflows/repair-pr787-finalize-payload-binding.yml:
- Around line 53-261: Replace the final whitespace-only validation around the
repair script with explicit postcondition checks for every targeted change.
After writing the router, Noema/OpenCode workflows, tests, documentation, and
CHANGELOG, assert that each required base_branch payload/environment/validation
field, digest verification, scoped permission, test assertion, documentation
sentence, and changelog entry exists exactly as intended; raise an error
identifying the missing postcondition before running git diff --check.

In `@tests/test_agent_mention_artifact_ledger.py`:
- Line 192: 테스트 함수 test_doctoring_records_artifact_ledger_contract의 오타를 수정하여 문서
계약을 검증한다는 의미가 드러나는 이름으로 변경하십시오. 테스트 로직과 동작은 그대로 유지하십시오.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b04c339a-d9be-49b6-89ce-080e0326be86

📥 Commits

Reviewing files that changed from the base of the PR and between 7ba61cb and 545caf0.

📒 Files selected for processing (14)
  • .github/workflows/agent-mention-noema-dispatch.yml
  • .github/workflows/agent-mention-opencode-dispatch.yml
  • .github/workflows/agent-mention-router-quality-ci.yml
  • .github/workflows/agent-mention-router.yml
  • .github/workflows/repair-pr787-finalize-payload-binding.yml
  • docs/automation/review-agent-comment-invocation.md
  • scripts/ci/agent_mention_router.py
  • scripts/ci/agent_mention_sweep.py
  • tests/test_agent_mention_artifact_ledger.py
  • tests/test_agent_mention_downstream_idempotency.py
  • tests/test_agent_mention_idempotency.py
  • tests/test_agent_mention_review_regressions.py
  • tests/test_agent_mention_router.py
  • tests/test_agent_mention_sweep_regressions.py
💤 Files with no reviewable changes (1)
  • .github/workflows/agent-mention-router-quality-ci.yml
🚧 Files skipped from review as they are similar to previous changes (5)
  • .github/workflows/agent-mention-router.yml
  • tests/test_agent_mention_downstream_idempotency.py
  • docs/automation/review-agent-comment-invocation.md
  • tests/test_agent_mention_router.py
  • scripts/ci/agent_mention_sweep.py

Comment thread .github/workflows/agent-mention-noema-dispatch.yml
Comment thread .github/workflows/repair-pr787-finalize-payload-binding.yml Outdated
@opencode-agent
opencode-agent Bot disabled auto-merge August 7, 2026 00:15
@seonghobae
seonghobae enabled auto-merge (squash) August 7, 2026 00:18
@opencode-agent
opencode-agent Bot disabled auto-merge August 7, 2026 00:19
@seonghobae
seonghobae enabled auto-merge (squash) August 7, 2026 00:46
@opencode-agent
opencode-agent Bot disabled auto-merge August 7, 2026 00:47

Copy link
Copy Markdown
Contributor Author

@opencode-agent review

Review exact head 0e5e597469b53a629a65c09f7b48637776cd0fdb read-only. Agent Mention Router Quality CI 31136584521, CodeQL 31136584520, Python Security 31136584528, Semgrep 31136584526, Security Scan 31136584514, Secret Scan 31136584519, OSV 31136584811, Scorecard 31136584523, and SBOM 31136584503 are successful. The last PR-controlled repair workflow has been deleted from the permanent scope. Verify exact-key artifact-ledger idempotency, partial-failure recovery, bounded lazy sweep, trusted actor/repository allowlists, immutable action pins, review-only downstream controls, and absence of branch mutation or merge authority. Submit a qualifying non-author approval only if current-head coverage/docstring and unresolved-thread gates pass.

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Review-only exact-head request for 0e5e597469b53a629a65c09f7b48637776cd0fdb. Validate exact invocation-key concurrency serialization in both Noema/OpenCode wrappers, durable artifact-ledger idempotency, review-only authority, bounded sweep behavior, 100% production statement/branch coverage, public docstrings, and the successful exact-head security/supply-chain gates. Do not mutate the branch or merge.

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review

Independently review exact head 0e5e597469b53a629a65c09f7b48637776cd0fdb, focusing on non-forgeable invocation authority, exact-key race serialization, partial-failure replay resistance, least privilege, and absence of branch-update/merge/release authority. Do not mutate the branch or merge.

@seonghobae
seonghobae enabled auto-merge (squash) August 7, 2026 01:24

Copy link
Copy Markdown
Contributor Author

@opencode-agent review
@cwl-noema-review review
@coderabbitai review

Review exact head 0e5e597469b53a629a65c09f7b48637776cd0fdb read-only. Agent Mention Router Quality CI, CodeQL, Python Security, Semgrep, Security Scan, Secret Scan, OSV, Scorecard, and SBOM are successful; every inline thread is resolved or outdated and the last PR-controlled repair workflow is absent. Verify exact-key artifact-ledger idempotency, serialized per-key claims, per-agent partial completion, bounded lazy organization traversal, starvation-resistant dispatch accounting, trusted actor/repository allowlists, immutable action pins, review-only downstream controls, and absence of branch mutation or merge authority. Submit a qualifying non-author approval only if current-head coverage/docstring and protection gates pass; do not mutate or bypass protection.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
requested_head="0e5e597469b53a629a65c09f7b48637776cd0fdb"

printf '%s\n' '== Revision and PR identity =='
printf 'checkout: '; git rev-parse HEAD
printf 'requested: '; git rev-parse "${requested_head}^{commit}"
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision \
  --jq '{headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision}'
live_head="$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq '.headRefOid')"
live_base="$(gh pr view "$pr" --repo "$repo" --json baseRefOid --jq '.baseRefOid')"
printf 'merge-base: '; git merge-base "$requested_head" "$live_base"
printf '%s\n' '== Changed paths =='
git diff --name-status "${live_base}..${requested_head}"

printf '%s\n' '== Relevant source map =='
for file in \
  scripts/ci/agent_mention_router.py \
  scripts/ci/agent_mention_sweep.py \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  .github/workflows/agent-mention-router-quality-ci.yml
do
  printf '\n-- %s --\n' "$file"
  if [[ "$file" == *.py ]]; then
    ast-grep outline "$file" --items all 2>/dev/null || true
    rg -n -C 10 \
      -e '^def (parse_event|agent_invocation_key|agent_ledger_artifact_name|_artifact_records|dispatched_agents|dispatch_request|noema_payload|opencode_payload|sweep|main)' \
      -e 'TRUSTED_ASSOCIATIONS|artifact|ledger|invocation_key|base_branch|allowlist|max_dispatch|timeout|credential|except ' \
      "$file" || true
  else
    cat -n "$file"
  fi
done

printf '%s\n' '== Temporary workflows and mutation authority =='
fd -t f . .github/workflows | sort
rg -n -i -C 3 \
  '(repair-pr787|finalize|one[-_]?shot|temporary|cleanup|export|git (push|commit)|gh pr merge|workflow_dispatch|/merge|/releases|branches/.*/protection|contents:\s*write|pull-requests:\s*write)' \
  .github/workflows scripts/ci 2>/dev/null || true

printf '%s\n' '== Contract and regression coverage =='
for file in \
  tests/test_agent_mention_artifact_ledger.py \
  tests/test_agent_mention_idempotency.py \
  tests/test_agent_mention_downstream_idempotency.py \
  tests/test_agent_mention_rejection_idempotency.py \
  tests/test_agent_mention_sweep.py \
  tests/test_agent_mention_sweep_regressions.py \
  tests/test_agent_mention_workflow_contract.py
do
  if [ -f "$file" ]; then
    printf '\n-- %s --\n' "$file"
    rg -n -C 5 \
      '(canonical|digest|compare_digest|artifact|claim|partial|reject|budget|sweep|allowlist|credential|coverage|docstring)' \
      "$file" || true
  fi
done

printf '%s\n' '== Exact-head checks, reviews, and threads =='
gh pr view "$pr" --repo "$repo" --json reviews,statusCheckRollup \
  --jq '{reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'
gh api "repos/${repo}/commits/${requested_head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url,output}'
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          path
          line
          comments(first: 10) { nodes { author { login } body } }
        }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false) | {path,line,comments:[.comments.nodes[]|{author:.author.login,body}]}'

printf '%s\n' '== Branch protection =='
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}'

Length of output: 70385


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
head="0e5e597469b53a629a65c09f7b48637776cd0fdb"
base="e6fc91416c4fb13febd07b985c6e9c74fe888306"

printf '%s\n' '== Relevant test definitions =='
for file in \
  tests/test_agent_mention_artifact_ledger.py \
  tests/test_agent_mention_idempotency.py \
  tests/test_agent_mention_downstream_idempotency.py \
  tests/test_agent_mention_rejection_idempotency.py \
  tests/test_agent_mention_sweep.py \
  tests/test_agent_mention_sweep_regressions.py \
  tests/test_agent_mention_workflow_contract.py
do
  [ -f "$file" ] || continue
  printf '\n-- %s --\n' "$file"
  ast-grep outline "$file" --items all 2>/dev/null || true
  rg -n -i -C 3 \
    -e 'canonical' -e 'compare_digest' -e 'artifact' -e 'partial' \
    -e 'reject' -e 'max_dispatch' -e 'failure' -e 'coverage' -e 'docstring' \
    "$file" || true
done

printf '%s\n' '== Changed-scope mutation authority =='
git diff --name-only "${base}..${head}" -- .github/workflows scripts/ci |
  while IFS= read -r file; do
    printf '\n-- %s --\n' "$file"
    rg -n -i -C 2 \
      -e 'git push' -e 'git commit' -e 'gh pr merge' -e '/merge' \
      -e '/releases' -e 'branches/.*/protection' -e 'workflow_dispatch' \
      -e 'contents:[[:space:]]*write' -e 'pull-requests:[[:space:]]*write' \
      "$file" || true
  done

printf '%s\n' '== Exact-head status checks and reviews =='
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,mergeStateStatus,reviewDecision,reviews,statusCheckRollup \
  --jq '{headRefOid,baseRefOid,mergeStateStatus,reviewDecision,reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'

printf '%s\n' '== Non-success check runs for requested SHA =='
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url}'

printf '%s\n' '== Unresolved non-outdated threads =='
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          path
          line
        }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false)'

printf '%s\n' '== Main branch protection =='
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}'

Length of output: 33053


🏁 Script executed:

#!/bin/bash
set -u

repo="ContextualWisdomLab/.github"
pr="787"
head="0e5e597469b53a629a65c09f7b48637776cd0fdb"

printf '%s\n' '== Focused changed-automation mutation scan =='
for file in \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  .github/workflows/agent-mention-router-quality-ci.yml \
  scripts/ci/agent_mention_router.py \
  scripts/ci/agent_mention_sweep.py
do
  printf '\n-- %s --\n' "$file"
  grep -nEi -C 2 \
    'repair-pr787|finalize|one[-_]?shot|temporary|git (push|commit)|gh pr merge|workflow_dispatch|/merge|/releases|branches/.*/protection|contents:[[:space:]]*write|pull-requests:[[:space:]]*write' \
    "$file" || true
done

printf '%s\n' '== Exact-head PR checks and reviews =='
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,mergeStateStatus,reviewDecision,reviews,statusCheckRollup \
  --jq '{headRefOid,baseRefOid,mergeStateStatus,reviewDecision,reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'
printf 'pr-view status=%s\n' "$?"

printf '%s\n' '== Non-success check runs =='
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url}'
printf 'check-runs status=%s\n' "$?"

printf '%s\n' '== Unresolved non-outdated review threads =='
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved isOutdated path line }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false)'
printf 'threads status=%s\n' "$?"

printf '%s\n' '== Main protection =='
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}'
printf 'protection status=%s\n' "$?"

Length of output: 13739


@seonghobae I reviewed exact head 0e5e597469b53a629a65c09f7b48637776cd0fdb against base e6fc91416c4fb13febd07b985c6e9c74fe888306.

I found no new source-level blocker in the reviewed agent-mention router boundary.

  • The router accepts only OWNER, MEMBER, and COLLABORATOR comment associations. It rejects bot comments and invalid request data.
  • Each invocation key binds the repository, PR number, exact head SHA, base branch, agent, source comment ID, and requesting actor.
  • Both wrappers reconstruct the canonical payload. Both wrappers use hmac.compare_digest before artifact-ledger access.
  • Both wrappers serialize same-key work. They check the exact artifact name and upload a 30-day immutable claim before authoritative forwarding.
  • The router treats exact-name Actions artifacts as the durable idempotency authority. Target reactions and acknowledgement comments are not authority.
  • Per-agent artifacts support partial retry. The rejected OpenCode-only path has regression coverage for no target mutation.
  • The sweep uses a shared artifact cache. It increments the dispatch budget only for newly queued work. It isolates repository, PR, and dispatch failures.
  • The OpenCode wrapper requires trigger_reviews: true, review_dispatch_limit: "1", enable_auto_merge: false, update_branches: false, and merge_mode: "disabled".
  • The inspected workflow inventory does not include .github/workflows/repair-pr787-finalize-payload-binding.yml.
  • The quality workflow has pinned actions and requires full tests, 100% configured statement and branch coverage for the two production modules, 100% public-docstring coverage, compilation, and git diff --check.
  • The current unresolved-thread query returned no entries.

I cannot approve this exact head.

  • strix is still in_progress for this SHA.
  • GitHub reports REVIEW_REQUIRED and BLOCKED.
  • The review list contains no qualifying approval anchored to 0e5e597469b53a629a65c09f7b48637776cd0fdb.
  • The branch-protection API returned HTTP 403. I could not verify the live protection requirements.

Wait for strix to complete successfully. Then verify branch protection with a credential that can read it and obtain a qualifying independent approval for this exact head.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

Final read-only review for exact head 0e5e597469b53a629a65c09f7b48637776cd0fdb. Agent Mention Router Quality plus CodeQL, Python Security, SAST, Security Scan, Secret Scan, OSV, Scorecard, and SBOM are successful; all current inline threads are resolved or outdated. Verify exact-key artifact-ledger idempotency, per-agent partial completion, same-key serialization, bounded lazy sweep behavior, wrapper payload binding, reviewer-only mutation limits, and complete removal of transient branch writers. Submit a qualifying non-author approval only if no actionable finding remains. Do not mutate the branch, bypass protections, or merge.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
head="0e5e597469b53a629a65c09f7b48637776cd0fdb"

printf '%s\n' '== Revision identity =='
printf 'checkout: '; git rev-parse HEAD
printf 'requested: '; git rev-parse "${head}^{commit}"
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision \
  --jq '{headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision}'
base="$(gh pr view "$pr" --repo "$repo" --json baseRefOid --jq '.baseRefOid')"
printf 'merge-base: '; git merge-base "$head" "$base"

printf '%s\n' '== Changed router scope =='
git diff --name-status "${base}..${head}" -- \
  .github/workflows scripts/ci tests docs CHANGELOG.md

printf '%s\n' '== Relevant workflow inventory and transient-writer scan =='
fd -t f . .github/workflows | sort
rg -n -i -C 3 \
  '(repair-pr787|finalize|one[-_]?shot|temporary|cleanup|export|git (push|commit)|git\s+push|gh pr merge|workflow_dispatch|/merge|/releases|branches/.*/protection)' \
  .github/workflows scripts/ci 2>/dev/null || true

printf '%s\n' '== Permanent workflow declarations =='
for file in \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  .github/workflows/agent-mention-router-quality-ci.yml
do
  printf '\n-- %s --\n' "$file"
  cat -n "$file"
done

printf '%s\n' '== Router implementation outline and control points =='
ast-grep outline scripts/ci/agent_mention_router.py --items all
ast-grep outline scripts/ci/agent_mention_sweep.py --items all
rg -n -C 12 \
  -e '^def (parse_event|agent_invocation_key|agent_ledger_artifact_name|_artifact_records|dispatched_agents|dispatch_request|noema_payload|opencode_payload|sweep|main)' \
  -e 'TRUSTED_ASSOCIATIONS|canonical|compare_digest|artifact|ledger|base_branch|allowlist|max_dispatch|timeout|credential|except ' \
  scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py

printf '%s\n' '== Targeted contract and regression tests =='
for file in \
  tests/test_agent_mention_artifact_ledger.py \
  tests/test_agent_mention_idempotency.py \
  tests/test_agent_mention_downstream_idempotency.py \
  tests/test_agent_mention_rejection_idempotency.py \
  tests/test_agent_mention_sweep.py \
  tests/test_agent_mention_sweep_regressions.py \
  tests/test_agent_mention_workflow_contract.py
do
  [ -f "$file" ] || continue
  printf '\n-- %s --\n' "$file"
  ast-grep outline "$file" --items all 2>/dev/null || true
  rg -n -i -C 4 \
    '(canonical|digest|compare_digest|artifact|claim|partial|reject|budget|sweep|allowlist|credential|coverage|docstring)' \
    "$file" || true
done

printf '%s\n' '== Exact-head checks, reviews, and unresolved threads =='
gh pr view "$pr" --repo "$repo" \
  --json reviews,statusCheckRollup \
  --jq '{reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url}'
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved isOutdated path line }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false)'

printf '%s\n' '== Branch protection visibility =='
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}' || true

Length of output: 6752


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
head="0e5e597469b53a629a65c09f7b48637776cd0fdb"

printf '%s\n' '== Transient workflow names and mutation commands =='
fd -t f . .github/workflows | rg -i '(repair-pr787|finalize|one[-_]?shot|temporary|cleanup|export)' || true
rg -n -i -C 3 -e 'git[[:space:]]+(push|commit)' \
  -e 'gh[[:space:]]+pr[[:space:]]+merge' \
  -e 'workflow_dispatch' \
  -e '/merge' \
  -e '/releases' \
  -e 'branches/.*/protection' \
  .github/workflows scripts/ci || true

printf '%s\n' '== Router workflow trigger, permissions, and forwarding =='
for file in \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  .github/workflows/agent-mention-router-quality-ci.yml
do
  printf '\n-- %s --\n' "$file"
  cat -n "$file"
done

printf '%s\n' '== Router and sweep definitions =='
ast-grep outline scripts/ci/agent_mention_router.py --items all
ast-grep outline scripts/ci/agent_mention_sweep.py --items all
rg -n -C 12 -e '^def parse_event' \
  -e '^def agent_invocation_key' \
  -e '^def agent_ledger_artifact_name' \
  -e '^def _artifact_records' \
  -e '^def dispatched_agents' \
  -e '^def dispatch_request' \
  -e '^def noema_payload' \
  -e '^def opencode_payload' \
  -e '^def sweep' \
  -e 'TRUSTED_ASSOCIATIONS' \
  -e 'compare_digest' \
  -e 'ledger_artifact_cache' \
  -e 'MAX_DISPATCHES' \
  scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py

printf '%s\n' '== Targeted test contracts =='
for file in \
  tests/test_agent_mention_artifact_ledger.py \
  tests/test_agent_mention_idempotency.py \
  tests/test_agent_mention_downstream_idempotency.py \
  tests/test_agent_mention_rejection_idempotency.py \
  tests/test_agent_mention_sweep.py \
  tests/test_agent_mention_sweep_regressions.py \
  tests/test_agent_mention_workflow_contract.py
do
  printf '\n-- %s --\n' "$file"
  rg -n -i -C 3 -e 'canonical' -e 'artifact' -e 'partial' -e 'reject' \
    -e 'budget' -e 'sweep' -e 'coverage' -e 'docstring' "$file" || true
done

printf '%s\n' '== Exact-head checks and reviews =='
gh pr view "$pr" --repo "$repo" \
  --json reviews,statusCheckRollup \
  --jq '{reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'
printf '%s\n' '-- non-success checks --'
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url}'
printf '%s\n' '-- unresolved current threads --'
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) { nodes { isResolved isOutdated path line } }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false)'
printf '%s\n' '-- branch protection --'
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}' || true

Length of output: 150461


@seonghobae I reviewed pull request #787 at exact head 0e5e597469b53a629a65c09f7b48637776cd0fdb against base e6fc91416c4fb13febd07b985c6e9c74fe888306.

I found no actionable source-level defect in the requested agent-mention router scope.

  • The router accepts only OWNER, MEMBER, and COLLABORATOR comments. It rejects bot comments, malformed fields, and non-exact mentions.
  • Each invocation key binds the repository, PR number, exact head SHA, base branch, agent, comment ID, and requesting actor.
  • Both wrapper workflows reconstruct the canonical seven-field payload. They use hmac.compare_digest before artifact-ledger access and forwarding.
  • Both wrappers serialize work by invocation key. They inspect the exact artifact name, validate the response fail-closed, and upload a 30-day immutable claim before forwarding.
  • The router treats the exact-name Actions artifact as idempotency authority. Reactions and acknowledgement comments are not authority.
  • Per-agent claims support partial completion. The regression tests cover partial retry, rejection without target mutation, malformed ledger responses, and exact-name cache behavior.
  • The scheduled sweep uses a shared ledger cache. It increments the dispatch budget only for newly queued work. It isolates repository, PR, and request failures.
  • The OpenCode wrapper requires trigger_reviews: true, review_dispatch_limit: "1", enable_auto_merge: false, update_branches: false, and merge_mode: "disabled".
  • The changed workflow scope contains no PR-specific repair, finalization, cleanup, or branch-writer workflow.
  • The quality workflow pins its actions. It runs the full test suite and requires 100% configured statement coverage, branch coverage, and public-docstring coverage for the two router modules.
  • The unresolved current-thread query returned no entries.

I cannot submit approval for this head.

  • The exact-head strix check is still in_progress.
  • GitHub reports REVIEW_REQUIRED and BLOCKED.
  • The review data contains no qualifying independent approval for 0e5e597469b53a629a65c09f7b48637776cd0fdb.
  • The branch-protection endpoint returned HTTP 403. I could not verify the live protection requirements.

When strix completes successfully, verify branch protection with a credential that has read access. Then obtain a qualifying independent approval for this exact head.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review @coderabbitai review

Perform a fresh independent exact-head review of 0e5e597469b53a629a65c09f7b48637776cd0fdb against protected main e6fc91416c4fb13febd07b985c6e9c74fe888306. Review only: do not mutate the branch, synthesize author approval, bypass protections, merge, release, or publish.

Agent Mention Router Quality CI, Python Security, Security Scan, CodeQL, Semgrep, Secret Scan, OSV, Scorecard, and SBOM are successful on this head, CodeRabbit commit status is successful, and every review thread is resolved. Verify exact-key 30-day artifact-ledger idempotency, per-agent partial completion, same-key wrapper serialization with cancel-in-progress: false, canonical payload/digest binding including base branch and actor, bounded/lazy organization sweep, rejection idempotency, token and repository-dispatch permission boundaries, full-suite 100% production statement/branch/docstring evidence, and absence of transient branch writers or merge authority. Submit actionable findings or a formal exact-head verdict.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
head="0e5e597469b53a629a65c09f7b48637776cd0fdb"
base="e6fc91416c4fb13febd07b985c6e9c74fe888306"

printf '%s\n' '== Revision identity =='
printf 'checked-out: '; git rev-parse HEAD
printf 'requested head: '; git rev-parse "${head}^{commit}"
printf 'requested base: '; git rev-parse "${base}^{commit}"
printf 'merge base: '; git merge-base "$head" "$base"
printf '%s\n' '== Changed paths =='
git diff --name-status "${base}..${head}" -- \
  .github/workflows scripts/ci tests docs CHANGELOG.md

printf '%s\n' '== Relevant implementation structure =='
for file in scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py; do
  printf '\n-- %s --\n' "$file"
  ast-grep outline "$file" --items all
done

printf '%s\n' '== Invocation keys, ledger, partial retry, and sweep controls =='
rg -n -C 10 \
  -e '^def (parse_event|agent_invocation_key|agent_ledger_artifact_name|_artifact_records|dispatched_agents|dispatch_request|noema_payload|opencode_payload|sweep|main)' \
  -e 'TRUSTED_ASSOCIATIONS|canonical|sha256|artifact|ledger|base_branch|actor|allowlist|ledger_artifact_cache|MAX_DISPATCHES|max_dispatch|timeout|except ' \
  scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py

printf '%s\n' '== Permanent workflow declarations =='
for file in \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  .github/workflows/agent-mention-router-quality-ci.yml
do
  printf '\n-- %s --\n' "$file"
  cat -n "$file"
done

printf '%s\n' '== Transient workflow and mutation-authority scan =='
fd -t f . .github/workflows | sort
rg -n -i -C 3 \
  -e 'repair-pr787|finalize|one[-_]?shot|temporary|cleanup|export' \
  -e 'git[[:space:]]+(push|commit)' \
  -e 'gh[[:space:]]+pr[[:space:]]+merge' \
  -e 'workflow_dispatch' \
  -e '/merge|/releases|branches/.*/protection' \
  -e 'contents:[[:space:]]*write|pull-requests:[[:space:]]*write' \
  .github/workflows scripts/ci || true

printf '%s\n' '== Contract tests and quality requirements =='
for file in \
  tests/test_agent_mention_artifact_ledger.py \
  tests/test_agent_mention_idempotency.py \
  tests/test_agent_mention_downstream_idempotency.py \
  tests/test_agent_mention_rejection_idempotency.py \
  tests/test_agent_mention_sweep.py \
  tests/test_agent_mention_sweep_regressions.py \
  tests/test_agent_mention_workflow_contract.py
do
  printf '\n-- %s --\n' "$file"
  rg -n -i -C 5 \
    '(canonical|digest|compare_digest|artifact|claim|partial|reject|budget|sweep|credential|permission|coverage|docstring)' \
    "$file" || true
done

printf '%s\n' '== Exact-head PR state, checks, and reviews =='
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision,reviews,statusCheckRollup \
  --jq '{headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision,reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'

printf '%s\n' '== Non-success check runs for requested head =='
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url}'

printf '%s\n' '== Unresolved current review threads =='
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved isOutdated path line }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false)'

printf '%s\n' '== Branch-protection visibility =='
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}' || true

Length of output: 191357


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '== Router data model, key, ledger, and dispatch =='
sed -n '1,460p' scripts/ci/agent_mention_router.py | cat -n

printf '%s\n' '== Sweep controls and credential selection =='
sed -n '1,460p' scripts/ci/agent_mention_sweep.py | cat -n

printf '%s\n' '== Router workflow =='
cat -n .github/workflows/agent-mention-router.yml

printf '%s\n' '== Noema wrapper =='
cat -n .github/workflows/agent-mention-noema-dispatch.yml

printf '%s\n' '== OpenCode wrapper =='
cat -n .github/workflows/agent-mention-opencode-dispatch.yml

printf '%s\n' '== Router quality workflow =='
cat -n .github/workflows/agent-mention-router-quality-ci.yml

printf '%s\n' '== Focused mutation and authority references in router path =='
rg -n -i -C 4 \
  -e 'permissions:' \
  -e 'contents:[[:space:]]*write|pull-requests:[[:space:]]*write|issues:[[:space:]]*write|actions:[[:space:]]*write' \
  -e 'git[[:space:]]+(push|commit)|gh[[:space:]]+pr[[:space:]]+merge' \
  -e '/merge|/releases|branches/.*/protection|update-branch' \
  -e 'enable_auto_merge|update_branches|merge_mode|trigger_reviews|review_dispatch_limit' \
  -e 'repository_dispatch|/dispatches|/comments|/reactions' \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  scripts/ci/agent_mention_router.py \
  scripts/ci/agent_mention_sweep.py

printf '%s\n' '== Permanent router workflow inventory =='
fd -t f . .github/workflows | sort | rg 'agent-mention|repair-pr787|finalize-pr787' || true

Length of output: 91280


@seonghobae I reviewed pull request #787 at exact head 0e5e597469b53a629a65c09f7b48637776cd0fdb against base e6fc91416c4fb13febd07b985c6e9c74fe888306.

I found no actionable source-level defect in the requested agent-mention control-plane scope.

  • scripts/ci/agent_mention_router.py accepts only OWNER, MEMBER, and COLLABORATOR associations. It rejects bot comments and invalid request fields.
  • Each invocation key binds repository, PR number, exact head SHA, base branch, agent, source comment ID, and actor.
  • Both wrapper workflows rebuild the canonical payload and use hmac.compare_digest before ledger access.
  • Both wrapper workflows serialize same-key work with cancel-in-progress: false and queue: max.
  • Both wrapper workflows validate exact-name artifact responses. They upload a 30-day immutable artifact claim before downstream forwarding.
  • The router treats the exact-name artifact as the idempotency authority. Reactions and acknowledgement comments are not authority.
  • Per-agent artifact claims support partial completion and retry of only the missing agent.
  • The OpenCode rejection path does not create target-repository mutations.
  • The organization sweep uses a bounded lookback, bounded dispatch count, lazy pagination, shared ledger cache, and isolated failure accounting.
  • The sweep separates the target-repository credential from the central repository-dispatch credential.
  • The OpenCode path requires trigger_reviews: true, review_dispatch_limit: "1", enable_auto_merge: false, update_branches: false, and merge_mode: "disabled".
  • The permanent router workflow inventory contains no PR-specific repair or finalization workflow.
  • The inspected router path contains repository-dispatch, reaction, and acknowledgement-comment writes. I found no branch update, merge, release, or protection mutation in that path.
  • The quality workflow runs the complete pytest suite. It requires 100% configured statement and branch coverage for scripts/ci/agent_mention_router.py and scripts/ci/agent_mention_sweep.py. It also requires 100% public-docstring coverage, compilation, and git diff --check.

I cannot submit approval for this head.

  • The exact-head strix check is still in_progress.
  • GitHub reports REVIEW_REQUIRED and BLOCKED.
  • The review data contains no qualifying independent approval for 0e5e597469b53a629a65c09f7b48637776cd0fdb.
  • The branch-protection API returned HTTP 403. I could not verify the live protection requirements.

Wait for strix to complete successfully. Then verify branch protection with a credential that has read access. Obtain a qualifying independent approval for this exact head.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

Exact-head review request for 0e5e597469b53a629a65c09f7b48637776cd0fdb. The current head removes the final PR-specific writer workflow, preserves the exact-name artifact ledger and serialized per-key claim boundary, has zero unresolved inline threads, and has successful exact-head Agent Mention Router Quality CI, CodeQL, Python Security, Semgrep, Security Scan, Secret Scan, OSV, Scorecard, and SBOM runs. Review only this head against protected main; predecessor reviews and checks do not transfer. No branch update, author approval, or merge bypass is authorized.

@coderabbitai review
@cwl-noema-review
@opencode-agent

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@seonghobae have exceeded the limit for the number of chat messages per hour. Please wait 6 minutes and 2 seconds before sending another message.

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review @coderabbitai review

Review exact live head 0e5e597469b53a629a65c09f7b48637776cd0fdb. Agent Mention Router Quality CI, CodeQL, Python Security, SAST, Security Scan, Secret Scan, OSV, Scorecard, and SBOM are successful; every current thread is resolved and all request-changes reviews are predecessor-head evidence.

Verify exact trusted-actor/agent parsing, payload and base-branch binding, per-agent exact-key durable artifact claims, same-key wrapper serialization, partial-completion retries, no-op/rejected request budget behavior, lazy bounded organization sweep, candidate-level fault isolation, bounded diagnostics, app-token scope, immutable action pins, absence of temporary branch writers, and review-only downstream controls (enable_auto_merge=false, update_branches=false, merge_mode=disabled).

Submit a formal GitHub review with state APPROVED only if no actionable issue remains. A comment-only verdict is insufficient. Do not update the branch, reuse predecessor evidence, approve from the author identity, merge, release, or alter protections. Native auto-merge is enabled and remains subordinate to exact-head independent approval and branch protection.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@seonghobae have exceeded the limit for the number of chat messages per hour. Please wait 5 minutes and 6 seconds before sending another message.

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review @coderabbitai review

Review exact live head a32efd5abe2de84cf4dda82b8642093ce3d5a86b. Agent Mention Router Quality CI, CodeQL, Python Security, SAST, Security Scan, Secret Scan, OSV, Scorecard, and SBOM are successful on this exact head, and every inline thread is resolved or outdated.

Independently verify the final durable exact-name artifact ledger, per-agent invocation key binding including repository/PR/head/base/comment/actor, same-key wrapper serialization with cancel-in-progress: false, partial-completion retry behavior, rejected/no-op budget behavior, lazy bounded sweep, candidate-level failure isolation, bounded diagnostics, app-token scope, immutable action pins, absence of transient branch writers, and review-only downstream controls (enable_auto_merge=false, update_branches=false, merge_mode=disabled).

Submit a formal GitHub review with state APPROVED only if no actionable issue remains. A comment-only verdict is insufficient. Do not update the branch, reuse predecessor evidence, approve from the author identity, merge, release, or alter protections. Native auto-merge is enabled and remains subordinate to exact-head independent approval and branch protection.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
head="a32efd5abe2de84cf4dda82b8642093ce3d5a86b"

printf '%s\n' '== Exact revision and PR identity =='
printf 'checkout: '; git rev-parse HEAD
printf 'requested: '; git rev-parse "${head}^{commit}"
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision,author \
  --jq '{headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision,author:.author.login}'
base="$(gh pr view "$pr" --repo "$repo" --json baseRefOid --jq -r '.baseRefOid')"
printf 'requested base: '; printf '%s\n' "$base"
printf 'merge base: '; git merge-base "$head" "$base"

printf '%s\n' '== Changed router scope =='
git diff --name-status "${base}..${head}" -- \
  .github/workflows scripts/ci tests docs CHANGELOG.md

printf '%s\n' '== Workflow inventory and prohibited mutation scan =='
fd -t f . .github/workflows | sort
rg -n -i -C 3 \
  -e 'repair-pr787|finalize|one[-_]?shot|temporary|cleanup|export' \
  -e 'git[[:space:]]+(push|commit)' \
  -e 'gh[[:space:]]+pr[[:space:]]+merge' \
  -e 'workflow_dispatch' \
  -e '/merge|/releases|branches/.*/protection' \
  -e 'contents:[[:space:]]*write|pull-requests:[[:space:]]*write' \
  .github/workflows scripts/ci || true

printf '%s\n' '== Router and sweep structure =='
for file in scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py; do
  printf '\n-- %s --\n' "$file"
  ast-grep outline "$file" --items all 2>/dev/null || true
done

printf '%s\n' '== Invocation, ledger, retry, sweep, and diagnostics controls =='
rg -n -C 10 \
  -e '^def (parse_event|agent_invocation_key|agent_ledger_artifact_name|_artifact_records|dispatched_agents|dispatch_request|noema_payload|opencode_payload|sweep|main)' \
  -e 'TRUSTED_ASSOCIATIONS|canonical|sha256|compare_digest|artifact|ledger|base_branch|actor|allowlist|ledger_artifact_cache|MAX_DISPATCHES|max_dispatch|timeout|except ' \
  scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py

printf '%s\n' '== Permanent workflow declarations =='
for file in \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  .github/workflows/agent-mention-router-quality-ci.yml
do
  printf '\n-- %s --\n' "$file"
  cat -n "$file"
done

printf '%s\n' '== Contract and regression coverage =='
for file in \
  tests/test_agent_mention_artifact_ledger.py \
  tests/test_agent_mention_idempotency.py \
  tests/test_agent_mention_downstream_idempotency.py \
  tests/test_agent_mention_rejection_idempotency.py \
  tests/test_agent_mention_sweep.py \
  tests/test_agent_mention_sweep_regressions.py \
  tests/test_agent_mention_workflow_contract.py
do
  [ -f "$file" ] || continue
  printf '\n-- %s --\n' "$file"
  rg -n -i -C 5 \
    '(canonical|digest|compare_digest|artifact|claim|partial|reject|budget|sweep|credential|permission|coverage|docstring|timeout)' \
    "$file" || true
done

printf '%s\n' '== Exact-head checks, reviews, and unresolved threads =='
gh pr view "$pr" --repo "$repo" \
  --json reviews,statusCheckRollup \
  --jq '{reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'
printf '%s\n' '-- non-success exact-head check runs --'
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url}'
printf '%s\n' '-- unresolved non-outdated threads --'
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved isOutdated path line }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false)'

printf '%s\n' '== Main branch protection visibility =='
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}' || true

Length of output: 5027


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
head="a32efd5abe2de84cf4dda82b8642093ce3d5a86b"
base="e6fc91416c4fb13febd07b985c6e9c74fe888306"

printf '%s\n' '== Revision relation and changed scope =='
printf 'merge base: '; git merge-base "$head" "$base"
git diff --name-status "${base}..${head}" -- \
  .github/workflows scripts/ci tests docs CHANGELOG.md

printf '%s\n' '== Workflow inventory and mutation scan =='
fd -t f . .github/workflows | sort
rg -n -i -C 3 \
  -e 'repair-pr787|finalize|one[-_]?shot|temporary|cleanup|export' \
  -e 'git[[:space:]]+(push|commit)' \
  -e 'gh[[:space:]]+pr[[:space:]]+merge' \
  -e 'workflow_dispatch' \
  -e '/merge|/releases|branches/.*/protection' \
  -e 'contents:[[:space:]]*write|pull-requests:[[:space:]]*write' \
  .github/workflows scripts/ci || true

printf '%s\n' '== Router and sweep implementation map =='
for file in scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py; do
  printf '\n-- %s --\n' "$file"
  ast-grep outline "$file" --items all 2>/dev/null || true
done

printf '%s\n' '== Exact control points =='
rg -n -C 10 \
  -e '^def (parse_event|agent_invocation_key|agent_ledger_artifact_name|_artifact_records|dispatched_agents|dispatch_request|noema_payload|opencode_payload|sweep|main)' \
  -e 'TRUSTED_ASSOCIATIONS|canonical|sha256|compare_digest|artifact|ledger|base_branch|actor|allowlist|ledger_artifact_cache|MAX_DISPATCHES|max_dispatch|timeout|except ' \
  scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py

printf '%s\n' '== Permanent workflow declarations =='
for file in \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  .github/workflows/agent-mention-router-quality-ci.yml
do
  printf '\n-- %s --\n' "$file"
  cat -n "$file"
done

printf '%s\n' '== Contract and regression coverage =='
for file in \
  tests/test_agent_mention_artifact_ledger.py \
  tests/test_agent_mention_idempotency.py \
  tests/test_agent_mention_downstream_idempotency.py \
  tests/test_agent_mention_rejection_idempotency.py \
  tests/test_agent_mention_sweep.py \
  tests/test_agent_mention_sweep_regressions.py \
  tests/test_agent_mention_workflow_contract.py
do
  [ -f "$file" ] || continue
  printf '\n-- %s --\n' "$file"
  rg -n -i -C 5 \
    '(canonical|digest|compare_digest|artifact|claim|partial|reject|budget|sweep|credential|permission|coverage|docstring|timeout)' \
    "$file" || true
done

printf '%s\n' '== Exact-head checks and reviews =='
gh pr view --repo="$repo" "$pr" \
  --json reviews,statusCheckRollup \
  --jq '{reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'
printf '%s\n' '-- non-success exact-head check runs --'
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url}'
printf '%s\n' '-- unresolved non-outdated threads --'
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved isOutdated path line }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false)'

printf '%s\n' '== Main branch protection visibility =='
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}' || true

Length of output: 137910


@seonghobae I reviewed exact head a32efd5abe2de84cf4dda82b8642093ce3d5a86b against base e6fc91416c4fb13febd07b985c6e9c74fe888306.

I found no actionable source-level defect in the requested agent-mention control-plane scope.

  • scripts/ci/agent_mention_router.py accepts only trusted OWNER, MEMBER, and COLLABORATOR comments. It rejects bot comments and malformed request fields.
  • Each invocation key binds the repository, PR number, exact head SHA, base branch, requested agent, source comment ID, and requesting actor.
  • Both wrapper workflows rebuild the canonical payload. Both use hmac.compare_digest before artifact-ledger access.
  • Both wrappers use same-key serialization with cancel-in-progress: false and queue: max.
  • Both wrappers validate exact-name artifact responses. They create a non-overwritable 30-day claim before downstream forwarding.
  • Per-agent claims support partial completion. The router retries only agents without a live exact-name claim.
  • Rejected OpenCode-only requests do not create target-repository mutations.
  • The sweep uses bounded lookback and dispatch limits. It shares a ledger cache, isolates candidate failures, and increments the budget only when it queues new work.
  • The OpenCode wrapper requires trigger_reviews=true, review_dispatch_limit=1, enable_auto_merge=false, update_branches=false, and merge_mode=disabled.
  • The inspected permanent workflow scope has no PR-specific repair or branch-writer workflow.
  • The quality workflow pins its actions and requires the complete test suite, 100% configured statement and branch coverage, 100% public-docstring coverage, compilation, and git diff --check.
  • The current unresolved-thread query returned no entries.

I cannot submit an approval for this head.

The current exact-head evidence has these blockers:

  1. strix is still in_progress.
  2. The exact-head check-run query reports repair as failure: details.
  3. GitHub reports REVIEW_REQUIRED and BLOCKED.
  4. The branch-protection API returned HTTP 403. I could not verify the live required checks and approvals.

Wait for strix to complete. Investigate or rerun the failed repair check. Then verify branch protection with a credential that has read access. After all required checks are successful and a qualifying independent approval is present, request approval through the explicit @coderabbitai approve command.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

/opencode

Repair exact current head a32efd5abe2de84cf4dda82b8642093ce3d5a86b directly on feat/review-agent-mention-router-main; do not create a stacked PR, do not update main, and do not add or execute another branch-writing workflow.

The new .github/workflows/repair-pr787-final-payload-binding.yml reintroduces the exact PR-specific writer pattern that prior security review required removing: it executes PR-head code, uses PR_REVIEW_MERGE_TOKEN, force-pushes the branch, and relies on runtime self-deletion. Remove this entire workflow from the merge diff. Do not retain any repair-pr787-*, finalize, one-shot, trigger, self-modifying, encoded-patch, or workflow-authorized branch writer.

Apply the intended complete-payload invocation-key binding as ordinary source/test commits in the canonical router and both dispatch wrappers. The durable claim/key must bind all security-relevant payload fields (target repository, PR number, exact head/base identity, agent, source comment ID, requesting actor, and any downstream mode flags) with canonical serialization and constant-time digest/key comparison. Preserve the existing per-key serialization, exact-name artifact ledger, fail-closed malformed response handling, review-only OpenCode settings, and least-privilege credential boundary.

Add/retain focused regressions proving that changing any bound payload field changes the invocation key and cannot reuse another claim, while byte-identical payloads remain idempotent. Run the full Agent Mention Router Quality CI, 100% production statement/branch coverage, 100% public docstrings, compilation, workflow syntax, security checks, and clean merge diff. Commit directly to the current branch and leave it unmerged until the exact new head is green.

@seonghobae
seonghobae marked this pull request as draft August 7, 2026 02:45
auto-merge was automatically disabled August 7, 2026 02:45

Pull request was converted to draft

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review @coderabbitai review

Perform a fresh read-only exact-head review of a32efd5abe2de84cf4dda82b8642093ce3d5a86b against protected main e6fc91416c4fb13febd07b985c6e9c74fe888306. Do not mutate the branch, synthesize author approval, bypass protections, merge, release, or publish.

Agent Mention Router Quality CI, Python Security, Security Scan, CodeQL, Semgrep, Secret Scan, OSV, Scorecard, and SBOM are successful on this head, and every review thread is resolved. Verify exact-key 30-day artifact-ledger idempotency, same-key wrapper serialization with cancel-in-progress: false, per-agent partial completion, canonical payload/digest binding including base branch and actor, bounded lazy sweep and failure isolation, rejection idempotency, exact repository-dispatch permission boundaries, 100% production statement/branch/docstring evidence, and absence of transient branch writers or merge authority. Submit actionable findings or a formal exact-head verdict.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
head="a32efd5abe2de84cf4dda82b8642093ce3d5a86b"
base="e6fc91416c4fb13febd07b985c6e9c74fe888306"

printf '%s\n' '== Revision identity =='
printf 'checked-out HEAD: '; git rev-parse HEAD
printf 'requested head: '; git rev-parse "${head}^{commit}"
printf 'requested base: '; git rev-parse "${base}^{commit}"
printf 'merge base: '; git merge-base "$head" "$base"
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision,author \
  --jq '{headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviewDecision,author:.author.login}'

printf '%s\n' '== Changed review scope =='
git diff --name-status "${base}..${head}" -- \
  .github/workflows scripts/ci tests docs CHANGELOG.md

printf '%s\n' '== Workflow inventory and prohibited-mutation scan =='
fd -t f . .github/workflows | sort
rg -n -i -C 3 \
  -e 'repair-pr787|finalize|one[-_]?shot|temporary|cleanup|export' \
  -e 'git[[:space:]]+(push|commit)' \
  -e 'gh[[:space:]]+pr[[:space:]]+merge' \
  -e 'workflow_dispatch' \
  -e '/merge|/releases|branches/.*/protection' \
  -e 'contents:[[:space:]]*write|pull-requests:[[:space:]]*write' \
  .github/workflows scripts/ci || true

printf '%s\n' '== Source structure =='
ast-grep outline scripts/ci/agent_mention_router.py --items all
ast-grep outline scripts/ci/agent_mention_sweep.py --items all

printf '%s\n' '== Router, ledger, dispatch, and sweep controls =='
rg -n -C 12 \
  -e '^def (parse_event|agent_invocation_key|agent_ledger_artifact_name|_artifact_records|dispatched_agents|dispatch_request|noema_payload|opencode_payload|sweep|main)' \
  -e 'TRUSTED_ASSOCIATIONS|canonical|sha256|compare_digest|artifact|ledger|base_branch|actor|allowlist|ledger_artifact_cache|MAX_DISPATCHES|max_dispatch|timeout|except ' \
  scripts/ci/agent_mention_router.py scripts/ci/agent_mention_sweep.py

printf '%s\n' '== Permanent workflow declarations =='
for file in \
  .github/workflows/agent-mention-router.yml \
  .github/workflows/agent-mention-noema-dispatch.yml \
  .github/workflows/agent-mention-opencode-dispatch.yml \
  .github/workflows/agent-mention-router-quality-ci.yml
do
  printf '\n-- %s --\n' "$file"
  cat -n "$file"
done

printf '%s\n' '== Relevant test contracts =='
for file in \
  tests/test_agent_mention_artifact_ledger.py \
  tests/test_agent_mention_idempotency.py \
  tests/test_agent_mention_downstream_idempotency.py \
  tests/test_agent_mention_rejection_idempotency.py \
  tests/test_agent_mention_sweep.py \
  tests/test_agent_mention_sweep_regressions.py \
  tests/test_agent_mention_workflow_contract.py
do
  if [ -f "$file" ]; then
    printf '\n-- %s --\n' "$file"
    rg -n -i -C 4 \
      '(canonical|digest|compare_digest|artifact|claim|partial|reject|budget|sweep|credential|permission|coverage|docstring|timeout)' \
      "$file" || true
  fi
done

printf '%s\n' '== Exact-head checks, reviews, and threads =='
gh pr view "$pr" --repo "$repo" \
  --json reviews,statusCheckRollup \
  --jq '{reviews:[.reviews[]|{author:.author.login,state,commitId:.commit.oid,submittedAt}],checks:[.statusCheckRollup[]|{name,status,conclusion,headSha}]}'
printf '%s\n' '-- Non-success exact-head check runs --'
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != "neutral") | {name,status,conclusion,details_url}'
printf '%s\n' '-- Unresolved non-outdated review threads --'
gh api graphql -F owner="ContextualWisdomLab" -F name=".github" -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved isOutdated path line }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and .isOutdated == false)'

printf '%s\n' '== Main branch-protection visibility =='
gh api "repos/${repo}/branches/main/protection" \
  --jq '{required_pull_request_reviews,required_status_checks,enforce_admins,required_conversation_resolution}' || true

Length of output: 140032


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/.github"
pr="787"
head="a32efd5abe2de84cf4dda82b8642093ce3d5a86b"
base="e6fc91416c4fb13febd07b985c6e9c74fe888306"
run_id="31139377211"
job_id="92745825870"

printf '%s\n' '== Exact revision and live PR state =='
git rev-parse HEAD
git rev-parse "${head}^{commit}"
git rev-parse "${base}^{commit}"
git merge-base "$head" "$base"
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,state,mergeStateStatus,reviewDecision \
  --jq '{headRefOid,baseRefOid,state,mergeStateStatus,reviewDecision}'

printf '%s\n' '== Exact-head workflow inventory =='
git ls-tree -r --name-only "$head" .github/workflows | sort
printf '%s\n' '-- Candidate transient workflows at exact head --'
git ls-tree -r --name-only "$head" .github/workflows |
  rg -i '(repair|finalize|one[-_]?shot|temporary|cleanup|export)' || true

printf '%s\n' '== Exact-head branch-writer scan in workflows =='
git grep -n -i -E \
  'git[[:space:]]+(push|commit)|gh[[:space:]]+pr[[:space:]]+merge|workflow_dispatch|/merge|/releases|branches/.*/protection|contents:[[:space:]]*write|pull-requests:[[:space:]]*write' \
  "$head" -- .github/workflows scripts/ci || true

printf '%s\n' '== Failed repair check metadata =='
gh api "repos/${repo}/actions/runs/${run_id}" \
  --jq '{id,name,display_title,event,status,conclusion,head_sha,head_branch,path,workflow_id,created_at,updated_at,html_url}'
gh api "repos/${repo}/actions/jobs/${job_id}" \
  --jq '{id,name,status,conclusion,started_at,completed_at,html_url,steps:[.steps[]|{name,status,conclusion,number}]}'

printf '%s\n' '== Failed repair run workflow file, when exposed =='
gh api "repos/${repo}/actions/runs/${run_id}/workflow" \
  --jq '{id,name,path,state,created_at,updated_at,html_url}' || true

printf '%s\n' '== Exact-head check-run details =='
gh api "repos/${repo}/commits/${head}/check-runs?per_page=100" \
  --jq '.check_runs[] | select(.name == "repair" or .name == "strix") | {id,name,status,conclusion,details_url,app:.app.slug,external_id,started_at,completed_at}'

Length of output: 21941


@seonghobae I reviewed exact head a32efd5abe2de84cf4dda82b8642093ce3d5a86b against main commit e6fc91416c4fb13febd07b985c6e9c74fe888306.

I found a blocking issue.

P1 — Remove the remaining PR-specific repair workflow

.github/workflows/repair-pr787-final-payload-binding.yml is present in the exact-head workflow tree.

The exact-head repair check comes from this workflow:

  • Workflow: Repair PR 787 final payload binding
  • Run: 31139377211
  • Trigger: push to feat/review-agent-mention-router-main
  • Result: failure
  • Failed step: Apply and verify complete payload binding
  • Line 108 contains a git commit operation. The workflow is a PR-specific repair artifact.

This conflicts with the required absence of temporary and workflow-authorized branch-writer mechanisms. Remove the complete workflow from the merge diff. Do not replace it with another repair, finalization, one-shot, self-modifying, or PR-specific writer workflow.

I also verified these current-head controls:

  • The router limits comments to OWNER, MEMBER, and COLLABORATOR.
  • The invocation key binds repository, PR number, head SHA, base branch, agent, comment ID, and actor.
  • Both wrappers rebuild the canonical payload and use hmac.compare_digest.
  • Both wrappers use per-key concurrency with cancel-in-progress: false and queue: max.
  • Both wrappers use exact-name artifact claims with 30-day retention and overwrite: false.
  • Artifact responses fail closed for malformed, mismatched, or truncated records.
  • Per-agent claims support partial retry.
  • The sweep bounds lookback and dispatch count. It shares the ledger cache and isolates repository, PR, and request failures.
  • The OpenCode wrapper requires review-only settings: trigger_reviews=true, review_dispatch_limit=1, enable_auto_merge=false, update_branches=false, and merge_mode=disabled.
  • The unresolved current-thread query returned no entries.

I cannot approve this head.

The exact-head checks also include:

  • repair: failure
  • strix: in progress
  • PR state: BLOCKED and REVIEW_REQUIRED

The branch-protection query returned HTTP 403. I could not verify live required checks or approval rules.

Remove .github/workflows/repair-pr787-final-payload-binding.yml. Then run the required checks on the resulting new head. Wait for strix to complete successfully. Verify branch protection with a credential that has read access before requesting approval again.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Continue directly on feat/review-agent-mention-router-main at exact head a32efd5abe2de84cf4dda82b8642093ce3d5a86b; do not open a stacked PR, update main, or add/execute another branch-writing workflow.

Remove .github/workflows/repair-pr787-final-payload-binding.yml entirely. It repeats the prohibited PR-specific writer pattern by executing PR-head code with a write credential, force-pushing the branch, and depending on runtime self-deletion. No repair-pr787-*, finalize, trigger, one-shot, self-modifying, encoded-patch, or workflow-authorized branch writer may remain.

Implement the intended payload binding as ordinary source and test commits in the canonical mention router and both dispatch wrappers. The invocation claim/key must canonically bind every security-relevant field: target repository, PR number, exact head SHA, exact base ref/SHA, requested agent, source comment ID, requesting actor, and every downstream mode/behavior flag. Compare digests/keys in constant time, preserve per-key serialization and the exact-name immutable artifact ledger, and fail closed on malformed or incomplete response metadata.

Add focused regressions proving that changing any one bound field changes the invocation key and cannot reuse another claim, while byte-identical canonical payloads remain idempotent. Preserve the review-only OpenCode configuration, least-privilege token boundary, bounded API diagnostics, 100% statement/branch coverage, public docstrings, workflow syntax, and current security checks.

Run the focused router contracts first, then the complete Agent Mention Router Quality CI and central security/supply-chain suite. Commit only permanent implementation/tests/docs/changelog to this branch and keep Draft until the exact new head is clean and green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants